Skip to content

fix: bypass Samsung DEFEX by loading libzygisk.so via remote memfd - #380

Closed
ducthoe wants to merge 1 commit into
PerformanC:mainfrom
ducthoe:fix/defex-memfd-injection
Closed

fix: bypass Samsung DEFEX by loading libzygisk.so via remote memfd#380
ducthoe wants to merge 1 commit into
PerformanC:mainfrom
ducthoe:fix/defex-memfd-injection

Conversation

@ducthoe

@ducthoe ducthoe commented Aug 6, 2026

Copy link
Copy Markdown

Samsung DEFEX blocks app_process64 from open()ing
/data/adb/modules paths, so the remote openat of libzygisk.so inside the zygote fails with -1 and injection aborts.

Instead of openat on the module path, create an anonymous memfd inside the target with memfd_create and fill it from the tracer (root) via /proc//fd/. Anonymous memory has no filesystem path, so path-based kernel checks (DEFEX, other LSMs) cannot block it. Works identically on devices without such restrictions.

Also add late-load.sh bootstrap for KernelSU late-load mode: it only starts the ptrace monitor when missing; the user is expected to trigger a soft reboot (ksud soft-reboot) themselves.

Samsung DEFEX blocks app_process64 from open()ing
/data/adb/modules paths, so the remote openat of libzygisk.so
inside the zygote fails with -1 and injection aborts.

Instead of openat on the module path, create an anonymous memfd
inside the target with memfd_create and fill it from the tracer
(root) via /proc/<pid>/fd/<n>. Anonymous memory has no filesystem
path, so path-based kernel checks (DEFEX, other LSMs) cannot
block it. Works identically on devices without such restrictions.

Also add late-load.sh bootstrap for KernelSU late-load mode:
it only starts the ptrace monitor when missing; the user is
expected to trigger a soft reboot (ksud soft-reboot) themselves.
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@ducthoe
ducthoe marked this pull request as draft August 6, 2026 14:46
@ducthoe ducthoe closed this Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant